// 侧边栏
// 滑动的值
var topp=0;
// 侧边栏单击,后滚轮到达位置
// 爱逛好货
$("#right-aside-content-1").click(function(event) {
	/* Act on the event */
	$('body,html').animate({'scrollTop':1079},1000);
});
// 好店直播
$("#right-aside-content-2").click(function(event) {
	/* Act on the event */
	$('body,html').animate({'scrollTop':1983},1000);
});
// 品质特色
$("#right-aside-content-3").click(function(event) {
	/* Act on the event */
	$('body,html').animate({'scrollTop':2780},1000);
});
// 实惠热卖
$("#right-aside-content-4").click(function(event) {
	/* Act on the event */
	$('body,html').animate({'scrollTop':3633},1000);
});
// 猜你喜欢
$("#right-aside-content-5").click(function(event) {
	/* Act on the event */
	$('body,html').animate({'scrollTop':4746},1000);
});
// 置顶
$("#right-aside-content-6").click(function(event) {
	/* Act on the event */
	$('body,html').animate({'scrollTop':0},1000);
});

// 鼠标移动倒侧边栏某一个模块 使这个小模块变色
$("#right-aside-content-1").mouseenter(function(event) {
	/* Act on the event */
	$("#right-aside-content-1").addClass("pitch-on-aside");
	$("#right-aside-content-after-1").removeClass("right-aside-content-after");
});
$("#right-aside-content-1").mouseleave(function(event) {
	/* Act on the event */
	if (topp>1983) {
		$("#right-aside-content-1").removeClass("pitch-on-aside");
		$("#right-aside-content-after-1").addClass("right-aside-content-after");
	}
});
$("#right-aside-content-2").mouseenter(function(event) {
	/* Act on the event */
	$("#right-aside-content-2").addClass("pitch-on-aside");
	$("#right-aside-content-after-2").removeClass("right-aside-content-after");
});
$("#right-aside-content-2").mouseleave(function(event) {
	/* Act on the event */
	if (topp<1983 || topp >2780) {
		$("#right-aside-content-2").removeClass("pitch-on-aside");
		$("#right-aside-content-after-2").addClass("right-aside-content-after");

	}
});
$("#right-aside-content-3").mouseenter(function(event) {
	/* Act on the event */
	$("#right-aside-content-3").addClass("pitch-on-aside");
	$("#right-aside-content-after-3").removeClass("right-aside-content-after");
});
$("#right-aside-content-3").mouseleave(function(event) {
	/* Act on the event */
	if (topp<2780 || topp>3633) {
		$("#right-aside-content-3").removeClass("pitch-on-aside");
		$("#right-aside-content-after-3").addClass("right-aside-content-after");	
	}	
});
$("#right-aside-content-4").mouseenter(function(event) {
	/* Act on the event */
	$("#right-aside-content-4").addClass("pitch-on-aside");
	$("#right-aside-content-after-4").removeClass("right-aside-content-after");
});
$("#right-aside-content-4").mouseleave(function(event) {
	/* Act on the event */
	if (topp<3633 || topp>4746) {
		$("#right-aside-content-4").removeClass("pitch-on-aside");
		$("#right-aside-content-after-4").addClass("right-aside-content-after");
	}
});
$("#right-aside-content-5").mouseenter(function(event) {
	/* Act on the event */
	$("#right-aside-content-5").addClass("pitch-on-aside");
	$("#right-aside-content-after-5").removeClass("right-aside-content-after");
});
$("#right-aside-content-5").mouseleave(function(event) {
	/* Act on the event */
	if (topp<4746) {
		$("#right-aside-content-5").removeClass("pitch-on-aside");
		$("#right-aside-content-after-5").addClass("right-aside-content-after");
	}
});
$("#right-aside-content-6").mouseenter(function(event) {
	/* Act on the event */
	$("#right-aside-content-6").addClass("pitch-on-aside");
	$("#right-aside-content-after-6").removeClass("right-aside-content-after");
});
$("#right-aside-content-6").mouseleave(function(event) {
	/* Act on the event */
	$("#right-aside-content-6").removeClass("pitch-on-aside");
	$("#right-aside-content-after-6").addClass("right-aside-content-after");
});
$("#right-aside-content-7").mouseenter(function(event) {
	/* Act on the event */
	$("#right-aside-content-7").addClass("pitch-on-aside");
	$("#right-aside-content-after-7").removeClass("right-aside-content-after");
});
$("#right-aside-content-7").mouseleave(function(event) {
	/* Act on the event */
	$("#right-aside-content-7").removeClass("pitch-on-aside");
	$("#right-aside-content-after-7").addClass("right-aside-content-after");
});
$("#right-aside-content-8").mouseenter(function(event) {
	/* Act on the event */
	$("#right-aside-content-8").addClass("pitch-on-aside");
	$("#right-aside-content-after-8").removeClass("right-aside-content-after");
});
$("#right-aside-content-8").mouseleave(function(event) {
	/* Act on the event */
	$("#right-aside-content-8").removeClass("pitch-on-aside");
	$("#right-aside-content-after-8").addClass("right-aside-content-after");
});
// 检测滚轮滑动
$(window).bind("scroll",function(){
	topp=$(this).scrollTop();//当前窗口的滚动距离
	// console.log(topp);
	// 对搜索框监听,置顶
	if (topp>250) {
		$('#right-aside').addClass('right-aside-1');
		$("#header-search2").addClass("header-search2-scroll");
		$("#right-aside-content-6").removeClass('right-aside-content-none');
	}else {
		$('#right-aside').removeClass('right-aside-1');
		$("#header-search2").removeClass("header-search2-scroll");
		$("#right-aside-content-6").addClass("right-aside-content-none");
	}
	// 检测窗口滚轮高度的位置添加侧边栏的颜色
	$("#right-aside-content-1").removeClass("pitch-on-aside");
	$("#right-aside-content-after-1").addClass("right-aside-content-after");
	$("#right-aside-content-2").removeClass("pitch-on-aside");
	$("#right-aside-content-after-2").addClass("right-aside-content-after");
	$("#right-aside-content-3").removeClass("pitch-on-aside");
	$("#right-aside-content-after-3").addClass("right-aside-content-after");
	$("#right-aside-content-4").removeClass("pitch-on-aside");
	$("#right-aside-content-after-4").addClass("right-aside-content-after");
	$("#right-aside-content-5").removeClass("pitch-on-aside");
	$("#right-aside-content-after-5").addClass("right-aside-content-after");
	if (topp<1983) {
		$("#right-aside-content-1").addClass("pitch-on-aside");
		$("#right-aside-content-after-1").removeClass("right-aside-content-after");
	}else if (topp>1982 && topp<2780) {
		$("#right-aside-content-2").addClass("pitch-on-aside");
		$("#right-aside-content-after-2").removeClass("right-aside-content-after");
	}else if  (topp>2779 && topp<3633) {
		$("#right-aside-content-3").addClass("pitch-on-aside");
		$("#right-aside-content-after-3").removeClass("right-aside-content-after");	
	}else if (topp>3632 && topp<4737) {
		$("#right-aside-content-4").addClass("pitch-on-aside");
		$("#right-aside-content-after-4").removeClass("right-aside-content-after");		
	}else if(topp>4736) {
		$("#right-aside-content-5").addClass("pitch-on-aside");
		$("#right-aside-content-after-5").removeClass("right-aside-content-after");
	}
});
 